package com.gitee.dubboOps.redis.Model;

import com.google.gson.Gson;
import com.taobao.jaket.model.ServiceDefinition;

import java.io.Serializable;

public class RedisDubboTestModel implements Serializable {
    private static final long serialVersionUID = -8391692776742829471L;

    private String redisKey; //redis中的key
    private String env;
    private String sdJson;

    public String getSdJson() {
        return sdJson;
    }

    public void setSdJson(String sdJson) {
        this.sdJson = sdJson;
    }

    public String getRedisKey() {
        return redisKey;
    }

    public void setRedisKey(String redisKey) {
        this.redisKey = redisKey;
    }

    public String getEnv() {
        return env;
    }

    public void setEnv(String env) {
        this.env = env;
    }

    public ServiceDefinition getServiceDefinition() throws Exception {
        return Gson.class.newInstance().fromJson(this.sdJson, ServiceDefinition.class);
    }

    public void setServiceDefinition(ServiceDefinition serviceDefinition) throws Exception {
        this.sdJson = Gson.class.newInstance().toJson(serviceDefinition);
    }
}
